package org.jfinanceobserver.persistence.jpa.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * This class is the QuotesActive entity
 *
 * $Author: r78v10a07@gmail.com $ $LastChangedDate: 2013-02-12 09:59:23 +0000 (Tue, 12 Feb 2013) $ $LastChangedRevision: 19 $
 *
 * @since Feb 11, 2013
 */
@Entity
@Table(name = "QuotesActive")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "QuotesActive.findAll", query = "SELECT q FROM QuotesActive q"),
    @NamedQuery(name = "QuotesActive.findById", query = "SELECT q FROM QuotesActive q WHERE q.id = :id"),
    @NamedQuery(name = "QuotesActive.findByName", query = "SELECT q FROM QuotesActive q WHERE q.name = :name"),
    @NamedQuery(name = "QuotesActive.findBySymbol", query = "SELECT q FROM QuotesActive q WHERE q.symbol = :symbol"),
    @NamedQuery(name = "QuotesActive.findByCurrency", query = "SELECT q FROM QuotesActive q WHERE q.currency = :currency"),
    @NamedQuery(name = "QuotesActive.findByActive", query = "SELECT q FROM QuotesActive q WHERE q.active = :active")})
public class QuotesActive implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "Name")
    private String name;
    @Basic(optional = false)
    @Column(name = "Symbol")
    private String symbol;
    @Lob
    @Column(name = "Info")
    private String info;
    @Column(name = "Currency")
    private String currency;
    @Basic(optional = false)
    @Column(name = "Active")
    private boolean active;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "activeid")
    private Collection<QuotesData> quotesDataCollection;

    public QuotesActive() {
    }

    public QuotesActive(Integer id) {
        this.id = id;
    }

    public QuotesActive(Integer id, String name, String symbol, boolean active) {
        this.id = id;
        this.name = name;
        this.symbol = symbol;
        this.active = active;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSymbol() {
        return symbol;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    @XmlTransient
    public Collection<QuotesData> getQuotesDataCollection() {
        return quotesDataCollection;
    }

    public void setQuotesDataCollection(Collection<QuotesData> quotesDataCollection) {
        this.quotesDataCollection = quotesDataCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof QuotesActive)) {
            return false;
        }
        QuotesActive other = (QuotesActive) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "QuotesActive{" + "id=" + id + ", name=" + name + ", symbol=" + symbol + ", info=" + info + ", currency=" + currency + ", active=" + active + ", quotesDataCollection=" + quotesDataCollection + '}';
    }
}
